const baseConfig = require("./webpack.config");
const { merge } = require("webpack-merge");
const webpack = require("webpack");
const TerserJSPlugin = require("terser-webpack-plugin");

const prodConfig = {
  mode: "production",
  plugins: [
    new webpack.DefinePlugin({
      IS_DEV: "false",
    }),
  ],
  optimization: {
    minimizer: [
      new TerserJSPlugin({
        terserOptions: {
          compress: {
            drop_console: true,
          },
        },
      }),
    ],
  },
  optimization: {
    splitChunks: {
      chunks: "all",
      minSize: 300000,
      maxSize: 0,
      minChunks: 1,
      automaticNameDelimiter: '~',
    },
  },
};

module.exports = merge(baseConfig, prodConfig);
